import Vue from 'vue'
import App from './App'
import store from './store/'
import ElementUI from 'element-ui'
import './assets/css/style.scss'
import router from './router/'
import Config from './config/app'
import {isLogin} from './utils/dataStorage'
import layer from 'vue-layer'

//<<<<<<< HEAD
//<<<<<<< HEAD
import mypublicjs from '@/public/mypublicjs'
//=======
// import mypublic from '@/public/mypublicjs'
//>>>>>>> e6d083f812021ac54393bf2bf88d38c8af696829
import axios from 'axios'
// import 'element-ui/lib/theme-chalk/index.css'
//=======
import mypublic from '@/public/mypublicjs'
//import axios from 'axios'
import 'element-ui/lib/theme-chalk/index.css'
//>>>>>>> 6cf610e87c6a91fc778f177d83dd13ac05e3a05a
//
//
// axios.defaults.baseURL="http://127.0.0.1/";
// Vue.prototype.axios=axios;
// Vue.config.productionTip = false
// Vue.prototype.get=mypublic.get
//<<<<<<< HEAD
//<<<<<<< HEAD
Vue.prototype.merge=mypublic.merge;
// Vue.prototype.dateFormat=mypublic.dateFormat;
//=======
// Vue.prototype.merge=mypublic.merge;
//>>>>>>> e6d083f812021ac54393bf2bf88d38c8af696829
//=======
Vue.prototype.merge=mypublic.merge;
//>>>>>>> 6cf610e87c6a91fc778f177d83dd13ac05e3a05a



Vue.prototype.$layer = layer(Vue);
Vue.prototype.$Config = Config;

Vue.use(ElementUI)

axios.defaults.withCredentials=true;
router.beforeEach((to, from, next) => {
  window.document.title = to.meta.title?to.meta.title+'-'+Config.siteName:Config.siteName;

  if (!isLogin() && to.path != '/login') {
    next({path: '/login'});
  } else {
    next();
  }
});


router.afterEach(transition => {

});

Vue.prototype.delete=function(id,status){
  mypublic.del(id,status,(id,status)=>{
    mypublic.get(url,(result)=>{
      this.$message({
        showClose: true,
        message: result.message,
        type: 'success'
      });
      this.reload();
    },{cId:id,active:status});
  })
}

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
}).$mount("#app")